package com.zzy;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

import org.apache.hadoop.io.WritableComparable;

/**
 * @author 邹靓仔
 * @date 2020/5/19 -10:50 -flowsum
 **/
public class FlowBean implements WritableComparable<FlowBean> {
    private String phoneNumber;//电话号码
    private long upFlow;//打进电话
    private long downFlow;//打出电话
    private long sumFlow;//总次数

    public String getPhoneNumber() {
        return phoneNumber;
    }
    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }
    public long getUpFlow() {
        return upFlow;
    }
    public void setUpFlow(long upFlow) {
        this.upFlow = upFlow;
    }
    public long getDownFlow() {
        return downFlow;
    }
    public void setDownFlow(long downFlow) {
        this.downFlow = downFlow;
    }
    public long getSumFlow() {
        return sumFlow;
    }
    public void setSumFlow(long sumFlow) {
        this.sumFlow = sumFlow;
    }

    public FlowBean(String phoneNumber, long upFlow, long downFlow) {
        this.phoneNumber = phoneNumber;
        this.upFlow = upFlow;
        this.downFlow = downFlow;
        this.sumFlow = upFlow + downFlow;
    }
    public FlowBean() {

    }

    @Override
    public String toString() {
        return "" + upFlow + "\t" + downFlow + "\t" + sumFlow + "";
    }
    public void readFields(DataInput in) throws IOException {
        phoneNumber = in.readUTF();
        upFlow = in.readLong();
        downFlow = in.readLong();
        sumFlow = in.readLong();

    }
    public void write(DataOutput out) throws IOException {
        out.writeUTF(phoneNumber);
        out.writeLong(upFlow);
        out.writeLong(downFlow);
        out.writeLong(sumFlow);

    }
    public int compareTo(FlowBean o) {
        return sumFlow > o.sumFlow ? -1 : 1;
    }


}




